sqlplus -s dbuser/oracle <<EOF >/dev/null
set colsep |;
set echo off;
set feedback off;
set heading off;
set pagesize 0;
set linesize 1000;
set numwidth 12;
set termout off;
set trimout on; 
set trimspool on;
spool tmp.txt;
select * from emp;
spool off;
exit
EOF
tr -d ' ' < tmp.txt >emp.txt

